package cn.edu.hit.education.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.edu.hit.education.dao.UserDepartmentMapper;
import cn.edu.hit.education.pojo.UserDepartment;
import cn.edu.hit.education.pojo.UserDepartmentExample;

@Service
public class UserDepartmentServiceImpl implements IUserDepartmentService {
	@Autowired
	UserDepartmentMapper userDepartmentMapper;
	
	@Override
	public int insert(UserDepartment userDepartment) {
		// TODO Auto-generated method stub
		return userDepartmentMapper.insert(userDepartment);
	}

	@Override
	public int deleteUserDepartmentByPrimaryKey(int id) {
		// TODO Auto-generated method stub
		return userDepartmentMapper.deleteByPrimaryKey(id);
	}

	@Override
	public int updateUserDepartment(UserDepartment userDepartment) {
		// TODO Auto-generated method stub
		return userDepartmentMapper.updateByPrimaryKey(userDepartment);
	}

	@Override
	public List<UserDepartment> queryUserDepartmentByUserPrimaryKey(int userId) {
		// TODO Auto-generated method stub
		UserDepartmentExample example = new UserDepartmentExample();
		UserDepartmentExample.Criteria criteria = example.createCriteria();
		criteria.andUserIdEqualTo(userId);
		return userDepartmentMapper.selectByExample(example);
	}

}
